<template>
	<view>
		<!-- 用户信息 -->
		<view class="user-info">
			<image class="avatar" :src="userInfo.avatarUrl"></image>
			<text class="nickname">{{userInfo.nickName}}</text>
		</view>
		<!-- 列表排版 -->
		<view class="panel-list">
			<!-- 第一个面板 -->
			<view class="panel-item">
				<view class="panel-content">
					<view class="conten-item">
						<text>8 </text>
						<text>收藏的店铺</text>
					</view>
					<view class="conten-item">
						<text>8 </text>
						<text>收藏的商品</text>
					</view>
					<view class="conten-item">
						<text>8 </text>
						<text>关注的商品</text>
					</view>
					<view class="conten-item">
						<text>8 </text>
						<text>足迹</text>
					</view>
				</view>
			</view>
			<!-- 第二个面板 -->
			<view class="panel-item">
				<view class="panel-title">
					我的订单
				</view>
				<view class="panel-content">
					<view class="conten-item">
						<image src="/static/my-icons/icon1.png"></image>
						<text>收藏的店铺</text>
					</view>
					<view class="conten-item">
						<image src="/static/my-icons/icon2.png"></image>
						<text>收藏的商品</text>
					</view>
					<view class="conten-item">
						<image src="/static/my-icons/icon3.png"></image>
						<text>关注的商品</text>
					</view>
					<view class="conten-item">
						<image src="/static/my-icons/icon4.png"></image>
						<text>足迹</text>
					</view>
				</view>
			</view>
			<!-- 第三个面板 -->
			<view class="panel-item">
				<view class="list-item">
					<text>收货地址</text>
					<uni-icons type="right"></uni-icons>
				</view>
				<view class="list-item">
					<text>联系客服</text>
					<uni-icons type="right"></uni-icons>
				</view>
				<view class="list-item" @click="logout">
					<text>退出登陆</text>
					<uni-icons type="right"></uni-icons>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState,mapMutations} from 'vuex'
	export default {
		name:"my-userinfo",
		data() {
			return {
				
			};
		},
		computed:{
			...mapState('m_user',['userInfo'])
		},
		methods:{
			...mapMutations('m_user',['updateToken']),
			// 退出登陆
			logout(){
				// 询问用户
				uni.showModal({
					title:'提示',
					content:'是否退出',
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// 	退出清空token
							this.updateToken('')
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #eee!important;
	}
.user-info{
	height: 200px;
	background-color: #ea4350;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	.avatar{
		width: 90px;
		height: 90px;
		border-radius: 50%;
		border: 2px solid #fff;
		box-shadow: 0 1px 5px #333;
		margin-bottom: 10px;
		
	}
	.nickname{
		color: #fff;
		font-weight: 700;
	}
}

.panel-list{
	padding: 0 6px;
	margin-top: -6px;
	.panel-item{
		background-color: #fff;
		border-radius: 5px;
		padding: 0 6px;
		margin-bottom: 6px;
		.list-item{
			line-height: 40px;
			border-bottom: 1px solid #eee;
			display: flex;
			justify-content: space-between;
			font-size: 14px;
			padding: 0 6px;
			&:last-child{
				barcode:none
			}
		}
		.panel-title{
			line-height: 40px;
			border-bottom: 1px solid #eee;
			padding-left: 6px;
			font-size: 14px;
			
		}
		.panel-content{
			display: flex;
			justify-content: space-around;
			align-items: center;
			padding: 6px 0;
			.conten-item{
				display: flex;
				flex-direction: column;
				align-items: center;
				font-size: 12px;
				image{
					width: 35px;
					height: 35px;
				}
			}
		}
	}
}
</style>